package com.jfour.misc.code;

public class Column {
	
	private String name;
	private String code;//列名
	private String comment;
	private String dataType;
	private boolean isPrimaryKey;
	private int length;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getComment() {
		if(comment == null || "".equals(comment)){
			return name;
		}		
		return comment;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}
	public String getDataType() {
		return dataType;
	}
	public void setDataType(String dataType) {
		if(dataType != null && dataType.indexOf("(") > -1) {
			dataType = dataType.substring(0, dataType.indexOf("("));
		}
		this.dataType = dataType;
	}
	public void setPrimaryKey(boolean isPrimaryKey) {
		this.isPrimaryKey = isPrimaryKey;
	}
	public boolean isPrimaryKey() {
		return isPrimaryKey;
	}
	public void setLength(int length) {
		this.length = length;
	}
	public int getLength() {
		return length;
	}
}
